home *** CD-ROM | disk | FTP | other *** search
- on(press){
- if(_root.playGame)
- {
- if(this.shapePos != null)
- {
- _root.tar.swapDepths(++_root.d);
- _root.tar._x = this._x;
- _root.tar._y = this._y;
- _root.tx = this.x;
- _root.ty = this.y;
- _root.tpos = this.shapePos;
- _root.hit = true;
- _root.klik.start(0,1);
- }
- if(this.shapePos == null and _root.hit)
- {
- _root.playGame = false;
- _root.hit = false;
- _root.tar._x = -150;
- fpath = findPath(_root.myMap,_root.ty,_root.tx,this.y,this.x);
- if(fpath != null)
- {
- fpath.reverse();
- _root.counter = fpath.length;
- i = 0;
- while(i < fpath.length)
- {
- _root.movX[i] = fpath[i][1];
- _root.movY[i] = fpath[i][0];
- i++;
- }
- this.empty.gotoAndStop(_root.tpos + 1);
- _root.temp.gotoAndStop(2);
- _root.temp.shape.gotoAndStop(_root.tpos);
- _root.temp.swapDepths(2000 + ++d);
- _root.temp._x = _root.movX[0] * 28;
- _root.temp._y = _root.movY[0] * 28;
- _root.myMap[_root.ty][_root.tx] = 1;
- _root["t_" + _root.ty + "_" + _root.tx].gotoAndStop(1);
- _root["t_" + _root.ty + "_" + _root.tx].shapePos = null;
- _root.lastX = this.x;
- _root.lastY = this.y;
- _root.moveTemp = true;
- }
- if(fpath == null)
- {
- _root.error.start(0,1);
- _root.playGame = true;
- }
- }
- }
- }
-